import functools
import time


def cal_time(func):
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        time1 = time.time()
        func(*args, **kwargs)
        time2 = time.time()
        print(func.__name__, ' times:', time2 - time1)

    return wrapper


@cal_time
def hasList():
    print(sum([x for x in range(1, 100000001)]))

@cal_time
def hasNoList():
    print(sum(x for x in range(1, 100000001)))


hasList()
hasNoList()
